<!DOCTYPE html>
<!-- saved from url=(0062)https://www.17sucai.com/preview/714616/2018-06-11/wj/demo.html -->
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
    <title>家庭财务状况</title>

    {% load static %}
    <link href="{% static 'taa/style.css' %}" rel="stylesheet" type="text/css">


</head>
<body style="">
<main class="cmp640 ">

        {% csrf_token %}
        <input type="hidden" value="{{ rowkey }}" name="rowkey"/>
    <div class="wrap">

        <h1>调查问卷</h1>

        <div style="border-bottom:1px dashed #ddd;"></div>

        {% if latest_finance_list %}
        {% for finance in latest_finance_list %}
        <div id="title{{ forloop.counter }}" style="margin-top:20px;">
            <h3>{{ forloop.counter }}.&nbsp;&nbsp;&nbsp;&nbsp;{{finance.assets_question}}<span class="req">&nbsp;*</span></h3>
            <ul class="textDiv">

                <li class="one">
                    <input type="text" id="info{{ forloop.counter }}" fid={{ finance.id }} name="info{{ forloop.counter }}" class="nums" value="0"/>
                </li>


            </ul>
        </div>
        {% endfor%}
        {% endif%}

    </div><!--end wrap-->
    <div class="txt-c width-5 hang40" style="margin:0 auto;">
        <div class="zi-bai bg-lan" style="border-radius:25px;" onclick="infoSub()">
            <span>提交</span>
        </div>
    </div>
    <!--</form>-->
    <div class="hang80"></div>

</main>
<!-- All JS -->
<script type="text/javascript" src="../../static/taa/jquery-1.11.0.min.js"></script>

<script type="text/javascript">
    function infoSub() {
        var res = {};
        var rowkey="{{ rowkey }}"
        var csrfmiddlewaretoken = '{{ csrf_token }}';
        for (var i = 1; i <= $(".nums").length; i++) {
            var info = $("#info" + i).val();
            var fid = $("#info" + i).attr("fid");
            res[fid]=info;
        }
        var send_data = {
            "rowkey":rowkey,
            "res": res,
            "csrfmiddlewaretoken": csrfmiddlewaretoken,
        };
        console.info(send_data)
        $.ajax({
            url: "/taa/finance/data",
            type: "POST",
            data: JSON.stringify(send_data),
            contentType: "application/json",
            dataType: "json",
            success: function (data) {
                if (data["status"] == "success") {
                    location.href = '/taa/' + rowkey + '/echarts'
                }

            }
        })


    }

</script>


</body>
</html>